local sk__zhoufu = fk.CreateSkill {

  name = "sk__zhoufu",

  tags = {  },

}



sk__zhoufu:addEffect(fk.TurnStart, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(sk__zhoufu.name) and target ~= player and not player:isKongcheng() and not target.dead
  end,
  on_cost = function(self, event, target, player, data)
    local card = player.room:askForDiscard(player, 1, 1, false, sk__zhoufu.name, true, ".", "#sk__zhoufu-invoke::"..target.id, true)
    if #card > 0 then
      event:setCostData(self, card)
      player.room:doIndicate(player.id, {target.id})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:throwCard(event:getCostData(self), sk__zhoufu.name, player, player)
    if target.dead then return end
    local judge = {
      who = target,
      reason = sk__zhoufu.name,
      pattern = ".|.|spade,club",
    }
    room:judge(judge)
    if target.dead then return end
    if judge.card.suit == Card.Spade then
      room:setPlayerMark(target, "@@sk__zhoufu-turn", 1)
    elseif judge.card.suit == Card.Club then
      room:askForDiscard(target, 2, 2, true, sk__zhoufu.name, false)
    end
  end,
})

sk__zhoufu:addEffect("invalidity", {
  name = "#sk__zhoufu_invalidity",
  invalidity_func = function(self, from, skill)
    return from:getMark("@@sk__zhoufu-turn") > 0 and skill:isPlayerSkill(from)
  end
})

return sk__zhoufu